from flask import Flask, flash, get_flashed_messages, request,redirect

app = Flask(__name__)
app.secret_key = "sdsdafsdf"


@app.route('/index')
def index():
    val =request.args.get('v')
    print(val)
    if val == 'oldboy':
        return 'Hello World'
    flash("超时错误",category='x1')
    return redirect('/error')

@app.route('/error')
def error():
    #category_filter只会取一类信息
    data = get_flashed_messages(category_filter='x1')
    if data:
        msg = data[0]
    else:
        msg = '....'
    return '错误信息:%s'%(msg)
if __name__ == '__main__':
    app.run()